from models import db
from models.index import Classify


def show_placeholder(article):
    if article:
        return article.title
    else:
        return "请填写标题"


def new_or_change(article):
    if article:
        return article.id
    else:
        return 0


def classify_show(id):
    classify = db.session.query(Classify).filter(Classify.id == id).first()
    return classify.name


def status_show(id):
    if id == 1:
        return "通过"
    else:
        return "待审核"


def show_admin(id):
    if id == True:
        return "管理员"
    else:
        return "普通用户"
